<?php
//require_once 'Controller/EventosController.php';
//require_once 'Controller/CadastroEventoController.php';
?>
<!DOCTYPE html>
<html>
    <head>
        <? require_once 'header.php'; ?>
        <script>
            var cont = 2;
            function lotes() {
                document.getElementById("container").innerHTML +=
                        "<div class = 'control-group'>" +
                        "<label class = 'control-label' for = 'edtLotesMasc" + cont + "'> Ingressos Lote " + cont + " </label>" +
                        "<div class = 'controls'>" +
                        "<input class = 'input-small' type = 'number' id = 'edtLotesMasc" + cont + "'name='edtLotesMas[]' ' placeholder = 'Valor Masc.'>" +
                        "<input class = 'input-small' type = 'number' id = 'edtLotesFem" + cont + "' name='edtLotesFem[]'  placeholder = 'Valor Fem.'>" +
                        "<input class = 'input-small' type = 'number' id = 'edtQuantidadeLote" + cont + "' name='edtQuantidade[]'  placeholder = 'Quantidade'>" +
                        "<a href = 'javascript: lotes()' < i class = 'icon-plus-sign'> </i></a>" +
                        "</div>" +
                        "</div>";
                cont++;
            }
        </script>       
    </head>
    <body>
        <?php
        getNavbar();
        ?>
        <div class="container-fluid" style="margin-top: 60px;">
            <div class="row-fluid">
                <div class="span3 container">
                    <div class="navbar">
                        <div class="navbar-inner">
                            <a class="brand" href="">Perfil</a>
                        </div>
                        <div class="container well">
                            <h3 style="margin: 0px;"><?php echo $evento->getTitulo(); ?></h3>
                            <? echo '<img class="img-polaroid span12" style="margin: 0px;" src="/Versao1/img/' . ($evento->getImagemPrincipal()->getImagem()) . '" alt="photo"><br>'; ?>
                            <form class="form-horizontal" method="POST" action="" enctype="multipart/form-data"> 
                                <input type="hidden" name="formUpdateImagemEventoRepublica" value="formUpdateImagemEventoRepublica"/>
                                <input class="span12" type="file" name="edtUpdateFoto"/>
                                <input type="hidden" name="edtEvento" value="<? echo $evento->getCodigo(); ?>"/>
                                <button type="submit" class="btn span12" style="margin: 0px;">Atualizar Imagem Principal</button>
                            </form>
                            <br>
                            <a href="#modalUpdateImagensEventoRepublica" role="button" class="btn span12" style="margin: 0px;" data-toggle="modal">Atualizar Imagens</a>
                            <div id="modalUpdateImagensEventoRepublica" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                                    <h3 id="myModalLabel">Atualizar Imagens</h3>
                                </div>
                                <div class="modal-body">
                                    <form method="POST" action="">
                                        <div class="span12">
                                            <input type="hidden" name="formRemoverImagensEventoRepublica" value="formRemoverImagensEventoRepublica"/>
                                            <?
                                            $image = $evento->getImagens();
                                            foreach ($image as $img) {
                                                ?>
                                                <div class="control-group span3" style="margin: 0px;">
                                                    <img class="img-polaroid span12" src="/Versao1/img/<? echo $img->getImagem() ?>" alt="photo">
                                                    <div class="controls">
                                                        <input type="checkbox" name="edtRemoverImagens[]" value="<? echo $img->getCodigo(); ?>">Remover</input>
                                                    </div>
                                                </div>

                                                <?
                                            }
                                            ?>
                                        </div>
                                        <div class="container">
                                            <button type="submit" class="btn">Remover Imagens Selecionadas</button>
                                        </div>
                                    </form>
                                    <hr class="clearfix"/>
                                    <form class="form-horizontal" method="POST" action="" enctype="multipart/form-data"> 
                                        <input type="hidden" name="formAddImagensEventoRepublica" value="formAddImagensEventoRepublica"/>
                                        <input class="span12" type="file" multiple="multiple" name="edtAddFotos[]"/>
                                        <input type="hidden" name="edtEvento" value="<? echo $evento->getCodigo(); ?>"/>
                                        <button type="submit" class="btn">Adicionar Imagens</button>
                                    </form>
                                </div>
                                <div class="modal-footer">
                                    <button class="btn" data-dismiss="modal" aria-hidden="true">Fechar</button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="span6 container">
                    <div class="navbar">
                        <div class="navbar-inner">
                            <a class="brand" href="#">Editar Eventos</a>
                        </div>
                        <div class="container well">
                            <form class="form-horizontal" method="POST" action="" enctype="multipart/form-data">
                                <input type="hidden" id="formEditarEventoRepublica" name="formEditarEventoRepublica" value="formEditarEventoRepublica"/>
                                <input type="hidden" name="codEvento" value="<? echo $evento->getCodigo(); ?>"/>
                                <div class="control-group">
                                    <label class="control-label" for="edtNomeEvento">Nome do evento</label>
                                    <div class="controls">
                                        <input type="text" id="edtNomeEvento" name="edtNomeEvento" placeholder="Nome do evento" value="<? echo $evento->getTitulo(); ?>" required>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="edtDescricaoEvento">Descrição do Evento</label>
                                    <div class="controls">
                                        <textarea class="text-left" name="edtDescricaoEvento" rows="4" cols="50" placeholder="Descrição" required><? echo $evento->getDescricao(); ?></textarea>
                                    </div>                                        
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="edtData">Data</label>
                                    <div class="controls">
                                        <input type="date" id="edtData" name="edtData" placeholder="Data" value="<? echo $evento->getData(); ?>" required>
                                    </div>
                                </div>
                                <div class="control-group">
                                    <label class="control-label" for="edtHoraInicio">Horário inicio</label>
                                    <div class="controls">
                                        <input type="time" id="edtHoraInicio" name="edtHoraInicio" value="<? echo $evento->getHoraInicio(); ?>" required>
                                    </div>
                                    <label class="control-label" for="edtHoraFim">Horário fim</label>
                                    <div class="controls">
                                        <input type="time" id="edtHoraFim" name="edtHoraFim" value="<? echo $evento->getHoraFim(); ?>" required>
                                    </div>
                                </div>
                                <?
                                $lotes = $evento->getLotes();
                                foreach ($lotes as $lote) {
                                    ?>
                                    <div id="container">
                                        <div class="control-group">
                                            <label class="control-label" for="edtLotesMas1">Ingressos Lote <? echo $lote->getNumero(); ?></label>
                                            <div class="controls">
                                                <input type="hidden" name="edtCodLote[]" value="<? echo $lote->getCodigo(); ?>"/>
                                                <input class="input-small" type="number" id="edtLotesMas1" name="edtLotesMas[]" value="<? echo $lote->getValorHomem(); ?>"/> <input class="input-small" type="number" id="edtLotesFem1" name="edtLotesFem[]" value="<? echo $lote->getValorMulher(); ?>"/><input class="input-small" type="number" id="edtQuantidadeLote1" name="edtQuantidadeLote[]" value="<? echo $lote->getQuantidade(); ?>"/>
                                            </div>
                                        </div>
                                    </div>
                                    <?
                                }
                                ?>
                                <div class="control-group">
                                    <div class="controls">
                                        <button class="btn" name="btnSubmit" type="submit" value="update" title="Update">Atualizar</button>
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
                <div class="span3 container">
                    <div class="navbar">
                        <div class="navbar-inner">
                            <a class="brand" href="">Eventos</a>
                        </div>
                        <div class="container well">

                        </div>
                    </div>
                </div>
            </div>
        </div>
        <?
        require_once 'footer.php';
        ?>
    </body>
</html>
<?
?>
